package com.ljtg.ljtgservice.controller.user;

import com.ljtg.constant.StatusConstant;
import com.ljtg.ljtgpojo.entity.Commodity;
import com.ljtg.ljtgpojo.vo.CommodityVO;
import com.ljtg.ljtgservice.service.CommodityService;
import com.ljtg.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;

@RestController("userDishController")
@RequestMapping("/user/dish")
@Slf4j
public class CommodityController {
    @Autowired
    private CommodityService commodityService;

    @Autowired
    private RedisTemplate redisTemplate;





 /**
     * 根据分类id 和售卖时间sale_time查询商品
     */
    @GetMapping("/list")
    public Result<List<CommodityVO>> list(Long categoryId , LocalDate saleTime) {
        Commodity commodity = new Commodity();
        commodity.setCategoryId(categoryId);
        commodity.setSaleTime(saleTime);

        List<CommodityVO> list = commodityService.listWithdetail(commodity);
        return Result.success(list);

    }


}
